import { HttpClient } from '@angular/common/http';
import { Component, OnInit, Input } from '@angular/core';

import { AlertController } from '@ionic/angular';

import { HttpService } from 'src/app/shared/service/http.service';

@Component({
  selector: 'app-zoology-system',
  templateUrl: './zoology-system.component.html',
  styleUrls: ['./zoology-system.component.scss'],
})
export class ZoologySystemComponent implements OnInit {
  listdata: any;
  @Input() tagData: any;
  constructor(private alertController: AlertController, private http: HttpService) { }

  ngOnInit() {
    this.listdata = this.tagData.data.iconList;
    /* this.tagData = {
              "type": "tag",
              "style": "app-serviceGuarantee-tag",
              "name": null,
              "linearLayout": "body",
              "data": {
                  "title": "五大生态保障系统",
                  "call": {
                      "phone": "0755-33356482",
                      "label": "合作咨询",
                      "tips": "铺铺旺"
                  },
                  "iconList": [{
                      "iconName": "../../../assets/img/brandguaranteeproject.png",
                      "label": "精准立项"
                  }, {
                      "iconName": "../../../assets/img/brandguaranteelocation.png",
                      "label": "整体定位"
                }, {
                      "iconName": "../../../assets/img/brandguaranteepattern.png",
                      "label": "启动模式"
                }, {
                      "iconName": "../../../assets/img/brandguaranteesystem.png",
                      "label": "运营系统"
                }, {
                      "iconName": "../../../assets/img/brandguaranteeeserve.png",
                      "label": "定向服务"
                }
                ]
              }
          }; */
    // tslint:disable-next-line: object-literal-key-quotes
    /*  this.listdata = [{'img': '../../../assets/img/brandguaranteeproject.png', 'text': '精准立项'},
     {'img': '../../../assets/img/brandguaranteelocation.png', 'text': '整体定位'},
     {'img': '../../../assets/img/brandguaranteepattern.png', 'text': '启动模式'},
     {'img': '../../../assets/img/brandguaranteesystem.png', 'text': '运营系统'},
     {'img': '../../../assets/img/brandguaranteeeserve.png', 'text': '定向服务'}]; */
    /* 取值 */
  }
  /* 拨打电话 */
  async call(mobile) {
    const alert = await this.alertController.create({
      header: '',
      message: '铺铺旺' + " " + mobile,
      buttons: [
        {
          text: '取消',
          role: 'cancel',
          cssClass: 'secondary'
        }, {
          text: '拨打',
          handler: () => {
            this.http.changeCallNumber(mobile);
          }
        }
      ]
    });
    await alert.present();
  }
}
